#include<iostream>

using namespace std;

void input(int a[], int n) {
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
}

void output(int a[], int n) {
    for (int i = 0; i < n; i++) {
        cout << a[i] << " ";
    }
    cout << endl;
}

void sort(int a[], int n, bool (*cmp)(int, int)) {
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j <= n - i - 2; j++) {
            if (!cmp(a[j], a[j + 1])) {
                int t = a[j];
                a[j] = a[j + 1];
                a[j + 1] = t;
            }
        }
        output(a, n);
    }
}

bool cmp2(int x, int y) {
    return x > y;

}

int main() {
    int a[10] = {1, 3, 5, 7, 9, 2, 4, 6, 8, 0};
    sort(a, 10, cmp2);
    output(a, 10);


    return 0;
}
